package com.zqp.web.fiter;

import java.io.IOException;
import java.util.Date;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
* @author zqp
* @date 2017年12月19日 
* @description 
*/
//@Component
public class TimeFilter implements Filter {

	@Override
	public void destroy() {
		System.out.println("timer filter destroy");

	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
			throws IOException, ServletException {
		System.out.println("timer filter start");
		long start = new Date().getTime();
		chain.doFilter(request, response);
		
		System.out.println("timer filter 耗时" + (new Date().getTime()  -start));
		
		System.out.println("timer filter finish");
		

	}

	@Override
	public void init(FilterConfig arg0) throws ServletException {
		System.out.println("timer filter init");

	}

}
